 /* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

容器镜像仓库
容器镜像仓库服务

OpenAPI spec version: v1
Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/


#import <Foundation/Foundation.h>
#import <JDCloudOCSDKCr/CrExecutor.h>

@implementation CrClient

@synthesize userAgent = _userAgent;
@synthesize serviceName = _serviceName;
@synthesize version = _version;

-(void) addCustomerHeaderWithKey:(NSString*) key
                           value:(NSString*) value{
    if(![self customHeader])
    {
        self.customHeader = [[NSMutableDictionary alloc] init];
    }
    if(key && value)
    {
        [[self customHeader] setValue:value forKey:key];
    }
   
}

-(id)initWithGlobalConfig{
    if(![GlobalConfig credential])
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@"GlobalConfig credential not config" userInfo:nil];
        @throw e;
    }
    self.credential = [GlobalConfig credential];
    if(![GlobalConfig sdkEnvironment])
    {
        self.sdkEnvironment = [[SDKEnvironment alloc] initWithEndPoint:@"cr.jdcloud-api.com"];
    }else
    {
        self.sdkEnvironment = [GlobalConfig sdkEnvironment];
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 cr  v1";
    _serviceName = @"cr";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}

-(id)initWithCredential:(Credential*)credential
         sdkEnvironment:(SDKEnvironment*)sdkEnvironment
{
    if(!credential)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" credential can not null" userInfo:nil];
        @throw e;
    }else{
        self.credential = credential;
    }
    
    if(!sdkEnvironment)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" sdkEnvironment can not null" userInfo:nil];
        @throw e;
    }else{
        self.sdkEnvironment = sdkEnvironment;
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 cr  v1";
    _serviceName = @"cr";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}

-(id)initWithCredential:(Credential*)credential
{
    if(!credential)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" credential can not null" userInfo:nil];
        @throw e;
    }else{
        self.credential = credential;
    }
    if(![GlobalConfig sdkEnvironment])
    {
        self.sdkEnvironment = [[SDKEnvironment alloc] initWithEndPoint:@"cr.jdcloud-api.com"];
    }else
    {
        self.sdkEnvironment = [GlobalConfig sdkEnvironment];
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 cr  v1";
    _serviceName = @"cr";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}

-(id)init{
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 cr  v1";
    _serviceName = @"cr";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}


/**
deleteImage sync request
@param deleteImageRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `deleteImageResponse` the request response data model
*/
-(NSDictionary*) deleteImageSyncWithRequest:(CrDeleteImageRequest*) deleteImageRequest
{
CrDeleteImageExecutor* excutor = [[CrDeleteImageExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:deleteImageRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDeleteImageResponse* response = [[CrDeleteImageResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"deleteImageResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)deleteImageAsyncWithRequest:(CrDeleteImageRequest*) deleteImageRequest
                       completionHandler:(void(^)(int statusCode,CrDeleteImageResponse* _Nullable deleteImageResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrDeleteImageExecutor* excutor = [[CrDeleteImageExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:deleteImageRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDeleteImageResponse* response = [[CrDeleteImageResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
describeRepositories sync request
@param describeRepositoriesRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `describeRepositoriesResponse` the request response data model
*/
-(NSDictionary*) describeRepositoriesSyncWithRequest:(CrDescribeRepositoriesRequest*) describeRepositoriesRequest
{
CrDescribeRepositoriesExecutor* excutor = [[CrDescribeRepositoriesExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:describeRepositoriesRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDescribeRepositoriesResponse* response = [[CrDescribeRepositoriesResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"describeRepositoriesResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)describeRepositoriesAsyncWithRequest:(CrDescribeRepositoriesRequest*) describeRepositoriesRequest
                       completionHandler:(void(^)(int statusCode,CrDescribeRepositoriesResponse* _Nullable describeRepositoriesResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrDescribeRepositoriesExecutor* excutor = [[CrDescribeRepositoriesExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:describeRepositoriesRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDescribeRepositoriesResponse* response = [[CrDescribeRepositoriesResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
releaseAuthorizationToken sync request
@param releaseAuthorizationTokenRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `releaseAuthorizationTokenResponse` the request response data model
*/
-(NSDictionary*) releaseAuthorizationTokenSyncWithRequest:(CrReleaseAuthorizationTokenRequest*) releaseAuthorizationTokenRequest
{
CrReleaseAuthorizationTokenExecutor* excutor = [[CrReleaseAuthorizationTokenExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:releaseAuthorizationTokenRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrReleaseAuthorizationTokenResponse* response = [[CrReleaseAuthorizationTokenResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"releaseAuthorizationTokenResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)releaseAuthorizationTokenAsyncWithRequest:(CrReleaseAuthorizationTokenRequest*) releaseAuthorizationTokenRequest
                       completionHandler:(void(^)(int statusCode,CrReleaseAuthorizationTokenResponse* _Nullable releaseAuthorizationTokenResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrReleaseAuthorizationTokenExecutor* excutor = [[CrReleaseAuthorizationTokenExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:releaseAuthorizationTokenRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrReleaseAuthorizationTokenResponse* response = [[CrReleaseAuthorizationTokenResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
describeAuthorizationTokens sync request
@param describeAuthorizationTokensRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `describeAuthorizationTokensResponse` the request response data model
*/
-(NSDictionary*) describeAuthorizationTokensSyncWithRequest:(CrDescribeAuthorizationTokensRequest*) describeAuthorizationTokensRequest
{
CrDescribeAuthorizationTokensExecutor* excutor = [[CrDescribeAuthorizationTokensExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:describeAuthorizationTokensRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDescribeAuthorizationTokensResponse* response = [[CrDescribeAuthorizationTokensResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"describeAuthorizationTokensResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)describeAuthorizationTokensAsyncWithRequest:(CrDescribeAuthorizationTokensRequest*) describeAuthorizationTokensRequest
                       completionHandler:(void(^)(int statusCode,CrDescribeAuthorizationTokensResponse* _Nullable describeAuthorizationTokensResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrDescribeAuthorizationTokensExecutor* excutor = [[CrDescribeAuthorizationTokensExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:describeAuthorizationTokensRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDescribeAuthorizationTokensResponse* response = [[CrDescribeAuthorizationTokensResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
checkRepositoryName sync request
@param checkRepositoryNameRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `checkRepositoryNameResponse` the request response data model
*/
-(NSDictionary*) checkRepositoryNameSyncWithRequest:(CrCheckRepositoryNameRequest*) checkRepositoryNameRequest
{
CrCheckRepositoryNameExecutor* excutor = [[CrCheckRepositoryNameExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:checkRepositoryNameRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrCheckRepositoryNameResponse* response = [[CrCheckRepositoryNameResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"checkRepositoryNameResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)checkRepositoryNameAsyncWithRequest:(CrCheckRepositoryNameRequest*) checkRepositoryNameRequest
                       completionHandler:(void(^)(int statusCode,CrCheckRepositoryNameResponse* _Nullable checkRepositoryNameResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrCheckRepositoryNameExecutor* excutor = [[CrCheckRepositoryNameExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:checkRepositoryNameRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrCheckRepositoryNameResponse* response = [[CrCheckRepositoryNameResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
describeImages sync request
@param describeImagesRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `describeImagesResponse` the request response data model
*/
-(NSDictionary*) describeImagesSyncWithRequest:(CrDescribeImagesRequest*) describeImagesRequest
{
CrDescribeImagesExecutor* excutor = [[CrDescribeImagesExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:describeImagesRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDescribeImagesResponse* response = [[CrDescribeImagesResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"describeImagesResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)describeImagesAsyncWithRequest:(CrDescribeImagesRequest*) describeImagesRequest
                       completionHandler:(void(^)(int statusCode,CrDescribeImagesResponse* _Nullable describeImagesResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrDescribeImagesExecutor* excutor = [[CrDescribeImagesExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:describeImagesRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDescribeImagesResponse* response = [[CrDescribeImagesResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
describeRegistries sync request
@param describeRegistriesRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `describeRegistriesResponse` the request response data model
*/
-(NSDictionary*) describeRegistriesSyncWithRequest:(CrDescribeRegistriesRequest*) describeRegistriesRequest
{
CrDescribeRegistriesExecutor* excutor = [[CrDescribeRegistriesExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:describeRegistriesRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDescribeRegistriesResponse* response = [[CrDescribeRegistriesResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"describeRegistriesResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)describeRegistriesAsyncWithRequest:(CrDescribeRegistriesRequest*) describeRegistriesRequest
                       completionHandler:(void(^)(int statusCode,CrDescribeRegistriesResponse* _Nullable describeRegistriesResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrDescribeRegistriesExecutor* excutor = [[CrDescribeRegistriesExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:describeRegistriesRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDescribeRegistriesResponse* response = [[CrDescribeRegistriesResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
describeRegistry sync request
@param describeRegistryRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `describeRegistryResponse` the request response data model
*/
-(NSDictionary*) describeRegistrySyncWithRequest:(CrDescribeRegistryRequest*) describeRegistryRequest
{
CrDescribeRegistryExecutor* excutor = [[CrDescribeRegistryExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:describeRegistryRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDescribeRegistryResponse* response = [[CrDescribeRegistryResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"describeRegistryResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)describeRegistryAsyncWithRequest:(CrDescribeRegistryRequest*) describeRegistryRequest
                       completionHandler:(void(^)(int statusCode,CrDescribeRegistryResponse* _Nullable describeRegistryResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrDescribeRegistryExecutor* excutor = [[CrDescribeRegistryExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:describeRegistryRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDescribeRegistryResponse* response = [[CrDescribeRegistryResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
getAuthorizationToken sync request
@param getAuthorizationTokenRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `getAuthorizationTokenResponse` the request response data model
*/
-(NSDictionary*) getAuthorizationTokenSyncWithRequest:(CrGetAuthorizationTokenRequest*) getAuthorizationTokenRequest
{
CrGetAuthorizationTokenExecutor* excutor = [[CrGetAuthorizationTokenExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:getAuthorizationTokenRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrGetAuthorizationTokenResponse* response = [[CrGetAuthorizationTokenResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"getAuthorizationTokenResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)getAuthorizationTokenAsyncWithRequest:(CrGetAuthorizationTokenRequest*) getAuthorizationTokenRequest
                       completionHandler:(void(^)(int statusCode,CrGetAuthorizationTokenResponse* _Nullable getAuthorizationTokenResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrGetAuthorizationTokenExecutor* excutor = [[CrGetAuthorizationTokenExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:getAuthorizationTokenRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrGetAuthorizationTokenResponse* response = [[CrGetAuthorizationTokenResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
createRepository sync request
@param createRepositoryRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `createRepositoryResponse` the request response data model
*/
-(NSDictionary*) createRepositorySyncWithRequest:(CrCreateRepositoryRequest*) createRepositoryRequest
{
CrCreateRepositoryExecutor* excutor = [[CrCreateRepositoryExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:createRepositoryRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrCreateRepositoryResponse* response = [[CrCreateRepositoryResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"createRepositoryResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)createRepositoryAsyncWithRequest:(CrCreateRepositoryRequest*) createRepositoryRequest
                       completionHandler:(void(^)(int statusCode,CrCreateRepositoryResponse* _Nullable createRepositoryResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrCreateRepositoryExecutor* excutor = [[CrCreateRepositoryExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:createRepositoryRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrCreateRepositoryResponse* response = [[CrCreateRepositoryResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
describeQuotas sync request
@param describeQuotasRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `describeQuotasResponse` the request response data model
*/
-(NSDictionary*) describeQuotasSyncWithRequest:(CrDescribeQuotasRequest*) describeQuotasRequest
{
CrDescribeQuotasExecutor* excutor = [[CrDescribeQuotasExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:describeQuotasRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDescribeQuotasResponse* response = [[CrDescribeQuotasResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"describeQuotasResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)describeQuotasAsyncWithRequest:(CrDescribeQuotasRequest*) describeQuotasRequest
                       completionHandler:(void(^)(int statusCode,CrDescribeQuotasResponse* _Nullable describeQuotasResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrDescribeQuotasExecutor* excutor = [[CrDescribeQuotasExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:describeQuotasRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDescribeQuotasResponse* response = [[CrDescribeQuotasResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
createRegistry sync request
@param createRegistryRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `createRegistryResponse` the request response data model
*/
-(NSDictionary*) createRegistrySyncWithRequest:(CrCreateRegistryRequest*) createRegistryRequest
{
CrCreateRegistryExecutor* excutor = [[CrCreateRegistryExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:createRegistryRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrCreateRegistryResponse* response = [[CrCreateRegistryResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"createRegistryResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)createRegistryAsyncWithRequest:(CrCreateRegistryRequest*) createRegistryRequest
                       completionHandler:(void(^)(int statusCode,CrCreateRegistryResponse* _Nullable createRegistryResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrCreateRegistryExecutor* excutor = [[CrCreateRegistryExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:createRegistryRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrCreateRegistryResponse* response = [[CrCreateRegistryResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
deleteRepository sync request
@param deleteRepositoryRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `deleteRepositoryResponse` the request response data model
*/
-(NSDictionary*) deleteRepositorySyncWithRequest:(CrDeleteRepositoryRequest*) deleteRepositoryRequest
{
CrDeleteRepositoryExecutor* excutor = [[CrDeleteRepositoryExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:deleteRepositoryRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDeleteRepositoryResponse* response = [[CrDeleteRepositoryResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"deleteRepositoryResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)deleteRepositoryAsyncWithRequest:(CrDeleteRepositoryRequest*) deleteRepositoryRequest
                       completionHandler:(void(^)(int statusCode,CrDeleteRepositoryResponse* _Nullable deleteRepositoryResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrDeleteRepositoryExecutor* excutor = [[CrDeleteRepositoryExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:deleteRepositoryRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDeleteRepositoryResponse* response = [[CrDeleteRepositoryResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
deleteRegistry sync request
@param deleteRegistryRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `deleteRegistryResponse` the request response data model
*/
-(NSDictionary*) deleteRegistrySyncWithRequest:(CrDeleteRegistryRequest*) deleteRegistryRequest
{
CrDeleteRegistryExecutor* excutor = [[CrDeleteRegistryExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:deleteRegistryRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDeleteRegistryResponse* response = [[CrDeleteRegistryResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"deleteRegistryResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)deleteRegistryAsyncWithRequest:(CrDeleteRegistryRequest*) deleteRegistryRequest
                       completionHandler:(void(^)(int statusCode,CrDeleteRegistryResponse* _Nullable deleteRegistryResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrDeleteRegistryExecutor* excutor = [[CrDeleteRegistryExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:deleteRegistryRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrDeleteRegistryResponse* response = [[CrDeleteRegistryResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
checkRegistryName sync request
@param checkRegistryNameRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `checkRegistryNameResponse` the request response data model
*/
-(NSDictionary*) checkRegistryNameSyncWithRequest:(CrCheckRegistryNameRequest*) checkRegistryNameRequest
{
CrCheckRegistryNameExecutor* excutor = [[CrCheckRegistryNameExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:checkRegistryNameRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrCheckRegistryNameResponse* response = [[CrCheckRegistryNameResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"checkRegistryNameResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)checkRegistryNameAsyncWithRequest:(CrCheckRegistryNameRequest*) checkRegistryNameRequest
                       completionHandler:(void(^)(int statusCode,CrCheckRegistryNameResponse* _Nullable checkRegistryNameResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
CrCheckRegistryNameExecutor* excutor = [[CrCheckRegistryNameExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:checkRegistryNameRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    CrCheckRegistryNameResponse* response = [[CrCheckRegistryNameResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}


 /**
 cr common sync request
 @param  jdcloudDataRequest request param
 @return key `statusCode` http request status code type is int
             `dataResult` the http request response data  type is NSData
             `requestError` the request error type is NSError
 */
 -(NSDictionary*) crCommonSyncWithRequest:(JDCloudDataRequest*) jdcloudDataRequest
                                                   url:(NSString*) url
                                                method:(NSString*) method{
    CommonExecutor* excutor = [[CommonExecutor alloc] initWithJDCloudClient:self url:url method:method];
    NSDictionary* responseResult = [excutor executeDataSync:jdcloudDataRequest];
    return responseResult;
}

-(void)crCommonAsyncWithRequest:(JDCloudDataRequest*) jdcloudDataRequest
                                         url:(NSString*) url
                                      method:(NSString*) method
                           completionHandler:(void(^)(int statusCode, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
     CommonExecutor* excutor = [[CommonExecutor alloc] initWithJDCloudClient:self url:url method:method];
    
    [excutor executeDataAsync:jdcloudDataRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        completionHandler(statusCode,responseData,error);
    }];
} 

@end
